﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>从表导入</title>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "DtlImpByJSON_" + GetQueryString("FK_MapData");
            var i = mapExt.RetrieveFromDBSources(); //从数据库来查询.

            //var en = mapExt.ToJsonWithParas();


            //基本属性.
            $("#TB_Title").val(mapExt.GetPara("Title"));
            $("#TB_SearchTip").val(mapExt.GetPara("SearchTip"));

            $("#TB_W").val(mapExt.W); //宽度.
            $("#TB_H").val(mapExt.H); //高度.

            GenerFullAllCtrlsVal(mapExt);

            //设置按钮是否可以用?
            if (i == 0)
                $("#Btn_Delete").attr("disabled", true);
            else
                $("#Btn_Delete").removeAttr("disabled");
        });

        function Delete() {

            if (confirm('您确定要删除吗？') == false)
                return;

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "DtlImpByJSON_" + GetQueryString("FK_MapData");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.
            mapExt.Delete();

            //删除就要设置，不能导出.
            var dtl = new Entity("BP.Sys.MapDtl", GetQueryString("FK_MapData"));
            dtl.ImpModel = 0; //设置不可导入.
            dtl.Update();

            window.location.href = window.location.href;
        }

        function Save() {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "DtlImpByJSON_" + GetQueryString("FK_MapData");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.

            mapExt.CopyForm();
            //CopyToEntity(mapExt);

            mapExt.FK_MapData = GetQueryString("FK_MapData");

            mapExt.SetPara("Title", $("#TB_Title").val());
            mapExt.SetPara("SearchTip", $("#TB_SearchTip").val());

            mapExt.W = $("#TB_W").val(); //宽度
            mapExt.H = $("#TB_H").val(); //高度

            //主题数据源.
            mapExt.Tag1 = $("#TB_Tag1").val(); //高度
            mapExt.Tag2 = $("#TB_Tag2").val(); //高度
            mapExt.Tag3 = $("#TB_Tag3").val(); //高度
            
            mapExt.Tag = $("#TB_Tag").val(); //高度
            mapExt.DBType = $("#DDL_DBType").val(); //导入模式

            mapExt.ExtType = "DtlImpByJSON";
            var i = mapExt.Save();

            //删除就要设置，不能导出.
            var dtl = new Entity("BP.Sys.MapDtl", GetQueryString("FK_MapData"));
            dtl.ImpModel = 1; //设置不可导入.
            dtl.Update();


            window.location.href = window.location.href;
        }
    </script>
</head>
<body>
    <form id="cc">
    <table id="Table1" style="width: 99%;">
        <caption>从表的导入配置</caption>
        <tr>
            <th colspan="2">基本信息配置</th>
        </tr>
        <tr>
            <td>标题</td>
            <td>
                <input type="text" id="TB_Title" style="width: 200px;" />
                <font color="gray">显示在窗口的文字，比如:关联流水 </font>
            </td>
        </tr>
        <tr>
            <td>弹窗属性</td>
            <td>
                高度:<input type="text" id="TB_H" style="width: 80px; text-align: right" />
                宽度:<input type="text" id="TB_W" style="width: 80px; text-align: right" />
            </td>
        </tr>
        <tr>
            <td>高级属性</td>
            <td>
                数据源类型<select id="DDL_DBType" name="DDL_DBType">
                    <option id="0" value="0">SQL模式</option>
                    <option id="1" value="1" selected="selected">JSON模式</option>
                </select>
                查询展示方式:
                <input type="radio" value="0" name="RB_SelectType" id="RB_SelectType_0" checked="checked" />
                <label for="RB_SelectType_0">平铺模式</label>
                <input type="radio" value="0" name="RB_SelectType" id="RB_SelectType_1" />
                <label for="RB_SelectType_0">下拉框模式</label>
            </td>
        </tr>
        <tr>
            <td>搜索提示</td>
            <td>
                <input type="text" id="TB_SearchTip"name="TB_SearchTip" style="width: 90%;" />
                <br/>
                <font color="gray">显示在搜索文本框的背景文字,比如：请输入付款人名称,进行搜索</font>
            </td>
        </tr>
        <tr>
            <th colspan="2">列表显示数据源</th>
        </tr>
        <tr>
            <td colspan="2">
                <textarea id="TB_Tag1" name="TB_Tag1" style="width: 99%; height: 37px;"></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <font color="gray">点击关键字执行搜索返回的数据源, 比如:/DataUser/Handler.ashx?DoType=DtlImpSearchKey&Keyword=@Key </font>
            </td>
        </tr>
        <tr>
            <th colspan="2">显示的中文列名</th>
        </tr>
        <tr>
            <td colspan="2">
                <input type="text" id="TB_Tag" name="TB_Tag" style="width: 100%;" />
                <font color="gray">比如:编号,电话,地址,邮件, 这个配置在显示的时候要替换掉数据源返回的英文列名. </font>
            </td>
        </tr>
        <tr>
            <th colspan="2">查询条件数据源</th>
        </tr>
        <tr>
            <td colspan="2">
                <textarea id="TB_Tag2" name="TB_Tag2" style="width: 99%; height: 23px;"></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                返回No,Name两个列的数据源 事例:/DataUser/Handler.ashx?DoType=DtlImpReqAll
                <br />
                SQL实例:
                <br />
                $Para=FK_BanJi#Label=所在班级#ListSQL=Select No,Name FROM Demo_BanJi
                <br />
                $Para=XB#Label=性别#EnumKey=XB
                <br />
            </td>
        </tr>
        <tr>
            <th colspan="2">
                填充从表数据源
            </th>
        </tr>
        <tr>
            <td colspan="2">
                <textarea id="TB_Tag3" name="TB_Tag3" style="width: 99%; height: 37px;"></textarea>
                <font color="gray">点击关键字执行搜索返回的数据源, 比如:/DataUser/Handler.ashx?DoType=DtlImpFullData&Keyword=@Key
                </font>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="保存" id="Btn_Save" name="Btn_Save" onclick="return Save()" />
                <input type="button" value="删除" id="Btn_Delete" name="Btn_Delete" onclick="return Delete()" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
